<?php 
try{

	$pdo=new PDO('mysql:dbname=zips;host=localhost','root','root');
	
}catch (PDOException $e){
	echo '<p> an error occurred:'.$e->getMessage().'</p>';
}
$q="select * from `zip_codes`";
//$q=$pdo->quote($q);
$r=$pdo->query($q);
while($row=$r->fetch()){
	echo $row[0]."<br>".$row[1];
}
$n=$r->rowCount();
echo "总共有".$n."条记录";
if($r){
	echo"执行成功";
}else{
	echo"执行失败";
}
 ?>